using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Portal.Core.DAL;

namespace Portal.BO.Editoral.Thucdon
{
    public class Thucdon
    {
        public static void Insert(string mon, string tue, string wed, string thu, string fri, string sat, string sun
            , string link_mon, string link_tue, string link_wed, string link_thu, string link_fri, string link_sat, string link_sun, int type, DateTime date)
        {
            date = DateTime.Now;
            using (MainDB objMain = new MainDB())
            {
                objMain.StoredProcedures.Menu_Insert(mon, tue, wed, thu, fri, sat, sun, link_mon, link_tue, link_wed, link_thu, link_fri, link_sat, link_sun, type, date);
            }
        }

        public static void Update(int menu_id, string mon, string tue, string wed, string thu, string fri, string sat, string sun
            , string link_mon, string link_tue, string link_wed, string link_thu, string link_fri, string link_sat, string link_sun, int type, DateTime date)
        {
            date = DateTime.Now;
            using (MainDB objMain = new MainDB())
            {
                objMain.StoredProcedures.Menu_Update(menu_id,mon, tue, wed, thu, fri, sat, sun, link_mon, link_tue, link_wed, link_thu, link_fri, link_sat, link_sun, type, date);
            }
        }

        public static DataTable GetThucDonGiaDinh()
        {
            using (MainDB objMain = new MainDB())
            {
                return objMain.SelectQuery("Select * From Menu Where type = 0");
            }
        }

        public static DataTable GetThucDonTrongTuan()
        {
            using (MainDB objMain = new MainDB())
            {
                return objMain.SelectQuery("Select * From Menu Where type = 1");
            }
        }

        public static string GetNewsTitleByID(string news_id)
        {
            if (news_id.Trim() != "")
            {
                DataTable dt;
                using (MainDB objMain = new MainDB())
                {
                    dt = objMain.SelectQuery("Select News_Title From News Where News_ID = " + news_id);
                }
                return dt.Rows.Count > 0 ? dt.Rows[0][0].ToString() : "";
            }
            else
            {
                return "";
            }
            
        }

        
    }

    


}
